package com.baoyi.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.baoyi.doamin.ImageItem;
import com.baoyi.service.ImageItemService;
import com.baoyi.widget.WeekItemWidget;

public class WeekItemAdapter extends BaseAdapter {
	private Context curcontext;
	private List<WeekItemWidget> widgets;

	public WeekItemAdapter(Context context,String type) {
		curcontext = context;
		List<ImageItem> list = ImageItemService.find(type);
		widgets = new ArrayList<WeekItemWidget>();
		if (null != list) {
			for (ImageItem imageItem : list) {
				widgets.add(new WeekItemWidget(curcontext, imageItem));
			}
		}
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return widgets.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		return widgets.get(position);
	}

}
